<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS 运算符</title>
    <script>
        /* JS 运算符 */
        function calculateOperation() {
            var y = 5;
            var x = 2;

            var x1 = x + y
            var x2 = x - y
            var x3 = x * y
            var x4 = y / x
            var x5 = y % x
            var x6 = x++
            var x7 = x--

            console.log(x1,x2,x3,x4,x5,x6,x7)

        }

        /*  JS  赋值运算符  类似于 C 中的 运算规则 */

        /* 对字符串和数字进行加法运算 如果把数字与字符串相加，结果将成为字符串。这点 和 C 等语言还是不同  */

        function testCalcuNumberAndString() {

            var  x=5+5;
            document.write(x);
            document.write("<br/>")

            x="5"+"5";
            document.write(x);
            document.write("<br/>")

            x=5+"5";
            document.write(x);
            document.write("<br/>")

            x="5"+5;
            document.write(x);
            document.write("<br/>")
        }



    </script>
</head>
<body>
    <button onclick="calculateOperation()">运算符</button><br/>
    <button onclick="testCalcuNumberAndString()">数字和字符串计算</button><br/>
</body>
</html>